package com.zhuiyun.project.api.plan.fitnessPlanActionCount.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.plan.fitnessPlanAction.entity.FitnessPlanAction;
import com.zhuiyun.project.api.plan.fitnessPlanAction.service.FitnessPlanActionService;
import com.zhuiyun.project.api.plan.fitnessPlanActionCount.entity.FitnessPlanActionCount;
import com.zhuiyun.project.api.plan.fitnessPlanActionCount.model.FitnessPlanActionCountModel;
import com.zhuiyun.project.api.plan.fitnessPlanActionCount.service.FitnessPlanActionCountService;
import com.zhuiyun.project.api.plan.fitnessPlanActionGroup.entity.FitnessPlanActionGroup;
import com.zhuiyun.project.api.plan.fitnessPlanActionGroup.model.FitnessPlanActionGroupModel;
import com.zhuiyun.project.api.plan.fitnessPlanActionGroup.service.FitnessPlanActionGroupService;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.constants.CommonConstants;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import com.zhuiyun.project.utils.pageUtil.PageResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName FitnessActionController
 * @Description TODO
 * @Author ys
 * @Date 2023/11/2 8:48
 **/
@RestController
@RequestMapping("/plan")
public class FitnessPlanActionCountController {
    @Autowired
    private FitnessPlanActionCountService fitnessPlanActionCountService;
    @Autowired
    private FitnessPlanActionGroupService fitnessPlanActionGroupService;
    /**
    * @Author 杨珅
    * @Description todo 健身计划动作分页查询
    * @Date 2023/11/2 9:28
    * @Return  * @param null
    */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作分页查询")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.SELECT, describe = "健身计划动作分页查询 ")
    @GetMapping("/getFitnessPlanActionCount")
            public CommonResult selectAll(PageRequest pageRequest,Integer planActionId){
        PageResult pageResult = fitnessPlanActionCountService.selectAll(pageRequest,planActionId);
        return CommonResult.ok(pageResult);
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作分页查询
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作分页查询")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.SELECT, describe = "健身计划动作分页查询 ")
    @GetMapping("/getFitnessPlanActionGroup")
    public CommonResult selectAllS(Integer planActionId){
        return CommonResult.ok(fitnessPlanActionGroupService.selectGroupAll(planActionId));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作分页查询
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作分页查询")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.SELECT, describe = "健身计划动作分页查询 ")
    @GetMapping("/getFitnessPlanActionGroups")
    public CommonResult selectAllSs(PageRequest pageRequest,Integer planActionId){
        return CommonResult.ok(fitnessPlanActionGroupService.selectAll(pageRequest,planActionId));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作分页查询
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作分页查询")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.SELECT, describe = "健身计划动作分页查询 ")
    @GetMapping("/getFitnessPlanActionGroupss")
    public CommonResult selectAllSss(Integer planActionId){
        return CommonResult.ok(fitnessPlanActionGroupService.selectGroupCount(planActionId));
    }
//    /**
//     * @Author 杨珅
//     * @Description todo 根据目的id全查标签
//     * @Date 2023/11/2 9:28
//     * @Return  * @param null
//     */
//    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
//    @ApiOperation(value = "根据目的id全查标签")
//    @OptLog(modular = "健身计划动作列表", type = CommonConstants.SELECT, describe = "根据目的id全查标签 ")
//    @GetMapping("/getFitnessTypes")
//    public CommonResult selectTypes(PageRequest pageRequest,Integer fitnessPurposeId){
//        PageResult pageResult = fitnessPlanActionService.selectTypes(pageRequest,fitnessPurposeId);
//        return CommonResult.ok(pageResult);
//    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作新增
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作新增")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.ADD, describe = "健身计划动作新增 ")
    @PostMapping("/addFitnessPlanActionCount")
    public CommonResult insertFitnessPlanActionCount(@RequestBody FitnessPlanActionCount fitnessPlanActionCount)throws CommonException {
        return CommonResult.ok(fitnessPlanActionCountService.insertFitnessPlanActionCount(fitnessPlanActionCount));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作新增
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作新增")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.ADD, describe = "健身计划动作新增 ")
    @PostMapping("/addFitnessPlanActionGroup")
    public CommonResult insertFitnessPlanActionGroup(@RequestBody FitnessPlanActionGroupModel fitnessPlanActionGroupModel)throws CommonException {
        return CommonResult.ok(fitnessPlanActionGroupService.insertFitnessPlanActionGroup(fitnessPlanActionGroupModel));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作修改
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作修改")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.UPDATE, describe = "健身计划动作修改 ")
    @PutMapping("/updateFitnessPlanActionGroup")
    public CommonResult updateFitnessPlanActionGroup(@RequestBody FitnessPlanActionGroup fitnessPlanActionGroup)throws CommonException{
        return CommonResult.ok(fitnessPlanActionGroupService.updateFitnessPlanActionGroup(fitnessPlanActionGroup));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作修改
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作修改")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.UPDATE, describe = "健身计划动作修改 ")
    @PutMapping("/updateFitnessPlanActionCount")
    public CommonResult updateFitnessPlanActionCount(@RequestBody FitnessPlanActionCount fitnessPlanActionCount)throws CommonException{
        return CommonResult.ok(fitnessPlanActionCountService.updateFitnessPlanActionCount(fitnessPlanActionCount));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作删除
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作删除")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.DELETE, describe = "健身计划动作删除 ")
    @DeleteMapping("/deleteFitnessPlanActionCount")
    public CommonResult deleteFitnessPlanActionCount(@RequestBody FitnessPlanActionCount fitnessPlanActionCount){
        return CommonResult.ok(fitnessPlanActionCountService.deleteFitnessPlanActionCount(fitnessPlanActionCount));
    }
    /**
     * @Author 杨珅
     * @Description todo 健身计划动作删除
     * @Date 2023/11/2 9:28
     * @Return  * @param null
     */
    @PreAuthorize("@ss.hasPermi('plan:fitnessPlanAction')")
    @ApiOperation(value = "健身计划动作删除")
    @OptLog(modular = "健身计划动作列表", type = CommonConstants.DELETE, describe = "健身计划动作删除 ")
    @DeleteMapping("/deleteFitnessPlanActionGroup")
    public CommonResult deleteFitnessPlanActionGroup(@RequestBody FitnessPlanActionGroup fitnessPlanActionGroup){
        return CommonResult.ok(fitnessPlanActionGroupService.deleteFitnessPlanActionGroup(fitnessPlanActionGroup));
    }
}
